<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>


<Script Language="VB" Runat="Server">
Function getCookie()
	Dim shtI As Short
	Dim valueC As String
	For shtI=0 To Request.Cookies.Count-1
		If ( Request.Cookies.Item(shtI).Name = "iPlanetDirectoryPro" ) Then
			valueC = Request.Cookies.Get(shtI).Value
		End If
	Next
	
	Return valuec
End Function
</Script>
<BODY>

<%
	Dim login,gotoURL,serverUrl,loginUrl,logout,logoutUrl
	Dim idstar
	idstar = Server.CreateObject("Idstar.IdentityManager")
	login = idstar.GetLoginURL()
	logout = idstar.GetLogoutURL()
	serverUrl = "http://localhost:19020"
	gotoUrl = serverUrl & Request.RawUrl
	loginUrl = login & "?goto=" & Server.UrlEncode(gotoUrl)
	logoutUrl = logout & "?goto=" & Server.UrlEncode(gotoUrl)
'	Response.Write(loginUrl)

	Dim cookieValue
	Dim currentUser
	cookieValue = getCookie()
		
	Response.Write("cookie value:" & Server.UrlDecode(cookieValue))
	
	currentUser = idstar.GetCurrentUser( "" & Server.UrlDecode(cookieValue) )
	
	If ( Len(currentUser) <> 0 ) Then
		Response.Write("Logined...")
		%>
		<p>Current User: <%= currentUser %>
		<p><a href="search.aspx">Property Search</a>
		<p><a href="<%= logoutUrl %>">Logout</a>
		<%
	Else
		%>
		<p>Please <a href="<%= loginUrl %>">Login</a>
		<%
	End If
	
%>
</BODY>
</HTML>
